package com.qumitech.visualnovel.controller.vo.basic;

import com.alibaba.fastjson.annotation.JSONField;

import java.text.NumberFormat;
import java.util.Date;

/**
 * @Author :  ZhChNing
 * @Descriptiom :
 * @Date Created in 2019/3/12 16:20
 */
public class RegisterChannelBasicStatisticsDataVO {

    @JSONField(name = "app_id")
    private String appId;
    @JSONField(name = "app_channel")
    private String appChannel;
    @JSONField(name = "app_name")
    private String appName;
    @JSONField(name = "app_version")
    private String appVersion;
    @JSONField(name = "target_date")
    private Date targetDate;
    @JSONField(name = "register_count")
    private Integer registerCount;
    @JSONField(name = "active_count")
    private Integer activeCount;
    @JSONField(name = "pay_success_count")
    private Integer paySuccessCount;
    @JSONField(name = "first_pay_success_count")
    private Integer firstPaySuccessCount;
    @JSONField(name = "register_pay_success_count")
    private Integer registerPaySuccessCount;
    @JSONField(name = "pay_count")
    private Integer payCount;
    @JSONField(name = "new_register_pay_rate")
    private String newRegisterPayRate;
    @JSONField(name = "active_pay_rate")
    private String activePayRate;

    public Integer getRegisterCount() {
        return registerCount;
    }

    public void setRegisterCount(Integer registerCount) {
        this.registerCount = registerCount;
    }

    public Integer getActiveCount() {
        return activeCount;
    }

    public void setActiveCount(Integer activeCount) {
        this.activeCount = activeCount;
    }

    public Integer getPayCount() {
        return payCount;
    }

    public void setPayCount(Integer payCount) {
        this.payCount = payCount;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppChannel() {
        return appChannel;
    }

    public void setAppChannel(String appChannel) {
        this.appChannel = appChannel;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public void calculateNewRegisterRate(){
        if (registerCount == 0){
            newRegisterPayRate = "-";
        }
        else {
            NumberFormat nt = NumberFormat.getPercentInstance();
            nt.setMinimumFractionDigits(2);
            newRegisterPayRate = nt.format(registerPaySuccessCount*1.00 / registerCount);
        }
    }

    public void calculateActivePayRate(){
        if (activeCount == 0){
            activePayRate = "-";
        }
        else {
            NumberFormat nt = NumberFormat.getPercentInstance();
            nt.setMinimumFractionDigits(2);
            activePayRate = nt.format(paySuccessCount*1.00 / activeCount);
        }
    }

    public Integer getPaySuccessCount() {
        return paySuccessCount;
    }

    public void setPaySuccessCount(Integer paySuccessCount) {
        this.paySuccessCount = paySuccessCount;
    }

    public Integer getFirstPaySuccessCount() {
        return firstPaySuccessCount;
    }

    public void setFirstPaySuccessCount(Integer firstPaySuccessCount) {
        this.firstPaySuccessCount = firstPaySuccessCount;
    }

    public Integer getRegisterPaySuccessCount() {
        return registerPaySuccessCount;
    }

    public void setRegisterPaySuccessCount(Integer registerPaySuccessCount) {
        this.registerPaySuccessCount = registerPaySuccessCount;
    }

    public String getNewRegisterPayRate() {
        return newRegisterPayRate;
    }

    public void setNewRegisterPayRate(String newRegisterPayRate) {
        this.newRegisterPayRate = newRegisterPayRate;
    }

    public String getActivePayRate() {
        return activePayRate;
    }

    public void setActivePayRate(String activePayRate) {
        this.activePayRate = activePayRate;
    }

    public Date getTargetDate() {
        return targetDate;
    }

    public void setTargetDate(Date targetDate) {
        this.targetDate = targetDate;
    }
}
